const utils = require('@/utils');
const bcrypt = require('@/utils/bcrypt');
const auth = require('@/middleware/auth');
const router = require('express').Router();
const userCtrl = require('@/controllers/system/user');
router.get('/list', auth.loginRequired, async (req, res) => {
	let hashPassword = await bcrypt.hashPass('cwj4865721..');
	console.log(hashPassword);
	console.log(await bcrypt.verifyPass('cwj4865721asd..', hashPassword));
	res.json({
		code: 200,
		message: 'success',
		data: {
			name: 'admin',
			avatar: 'https://img2.baidu.com/it/u=3118149361,421630814&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
			introduction: 'I am a super administrator'
		}
	});
});

router.post('/create', async (req, res) => {
	res.json({
		code: 200,
		message: 'success',
		data: {
			name: 'admin',
			avatar: 'https://img2.baidu.com/it/u=3118149361,421630814&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
			introduction: 'I am a super administrator',
			roles: ['admin']
		}
	});
});

router.post('/update', (req, res) => {
	res.json({
		code: 200,
		message: 'success'
	});
});

router.get('/delete/:id', (req, res) => {
	let id = req.params.id;
	res.json({
		code: 200,
		message: 'success',
		data: {
			token: 'admin-token'
		}
	});
});

router.get('/detail/:id', (req, res) => {
	let id = req.params.id;
	res.json({
		code: 200,
		message: 'success',
		data: {
			token: 'admin-token'
		}
	});
});

module.exports = router;